"""Install DAOS Storage Estimator"""
import sys


def install_storage_estimator_module(env, lib_prefix):
    """Install Storage Estimator module for the specified python version"""

    if GetOption("help"):
        return

    denv = env.Clone()
    version = f'{sys.version_info.major}.{sys.version_info.minor}'
    install_path = lib_prefix + "/python"
    install_path += version + "/site-packages/storage_estimator"

    denv.Install(install_path, "common/vos_structures.py")
    denv.Install(install_path, "common/__init__.py")
    denv.Install(install_path, "common/dfs_sb.py")
    denv.Install(install_path, "common/vos_size.py")
    denv.Install(install_path, "common/explorer.py")
    denv.Install(install_path, "common/parse_csv.py")
    denv.Install(install_path, "common/util.py")


def scons():
    """Execute build"""
    Import('env')

    denv = env.Clone()
    denv.Install("$PREFIX/bin/", "daos_storage_estimator.py")

    install_storage_estimator_module(env, '$PREFIX/lib64/')


if __name__ == "SCons.Script":
    scons()
